package com.wanho.java158.impl;

import com.github.pagehelper.PageInfo;
import com.wanho.java157.Orders;
import com.wanho.java157.OrdersMapper;
import com.wanho.java157.OrdersVoMapper;
import com.wanho.java157.po.BaseEntity;
import com.wanho.java157.vo.OrdersVo;
import com.wanho.java158.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.List;

@Service
public class OrdersServiceImpl implements OrdersService {
    @Autowired
    OrdersMapper ordersMapper;
    @Autowired
    OrdersVoMapper ordersVoMapper;

    @Override
    public Orders selectByCustomerId(Integer id) {
        return ordersMapper.selectByCustomerId(id);
    }

    @Override
    public boolean deleteByCustomerId(Integer id) {
        return false;
    }

    @Override
    public List<Orders> selectAll() {
        return ordersMapper.selectAll();
    }

    @Override
    public boolean removeDetail(Integer id) {
        return ordersMapper.removeDetail(id);
    }

    @Override
    public List<OrdersVo> selectByCustomerIdList(Integer id) {
        return ordersVoMapper.selectByCustomerId(id);
    }

    @Override
    public List<Orders> selectByOrderId(Integer id) {
        return ordersMapper.selectByOrderId(id);
    }

    @Override
    public boolean deleteByOrderId(Integer id) {
        ordersMapper.removeDetail(id);
        return ordersMapper.deleteByOrderId(id);
    }

    @Override
    public boolean update(Orders orders) {
        return ordersMapper.update(orders);
    }

    @Override
    public boolean add(Orders orders) {
        return ordersMapper.add(orders);
    }


}